#!/bin/bash

WDIR=/home/xyh/mps/

BIN=${WDIR}/dcds_extractor/bin/bin2fits
CFG=${WDIR}/dcds_extractor/ccd_config.ini

if [ -e tmp.fits ] 
then
	rm tmp.fits
fi

echo "reading $1"
echo "reading $2"

#${BIN} -c ${CFG} -b $1 -k $2
#${BIN} -c ${CFG} -b $1 

if [ $# -eq 1 ]
then
	${BIN} -c ${CFG} -b $1 -f tmp.fits
elif [ $# -eq 2 ]
then
	if [ -f $2 ]; then
		rm $2
	fi
	${BIN} -c ${CFG} -b $1 -f $2
fi


if [ -e tmp.fits ]
then
	ds9 tmp.fits &
fi
